#!/bin/sh

phplist="php81 php8 php7"
letsencrypt=/usr/sbin/lefh

find_php() {
	local x= path=

	for x in $phplist; do
		path=$(which $x)

		if [ -n "$path" ]; then
			echo $path
			break
		fi
	done
}

# start
php=$(find_php)

if [ -n "$php" ]; then
	$php $letsencrypt "$@"
else
	printf "ERROR: missing php interpreter\n"
	exit 1
fi

exit $?
